<?php
namespace app\api\model;

use think\Model;
use think\Db;

class ActivityModel extends Model
{
    function atvdetail($activityid) {
        $atv =  db('activity')->where('activityid', $activityid)->find();
        return $atv;
    }
    function atvlist() {
        $atv =  db('activity')->select();
        return ['atvlist'=>$atv];
    }
    function activityenroll($userid, $activityid) {
        $data=[
            'userid'=>$userid,
            'activityid'=>$activityid,
        ];
        $result=Db::name('activity_enroll')->insert($data);
        if($result){
            return  ['success'=>1];

        }else{
            return  ['success'=>0];
        }
    }
}